package cn.itsource.ymcc.feignclient.fallbackfactory;

import cn.itsource.ymcc.feignclient.SystemFeignClient;
import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SystemFeignClientFallbackFactory implements FallbackFactory<SystemFeignClient> {
    @Override
    public SystemFeignClient create(Throwable throwable) {
        return new SystemFeignClient() {
            @Override
            public JsonResult getEmployeeByLoginId(Long loginId) {
                return JsonResult.error(throwable.getMessage());
            }
        };
    }
}
